<?php
html::printPath(array('bankAccount.form-title' => 'admin/bankAccount/all', 'application.page-title-display' => ''));
$msg->printMessages();

echo html::entityInfoIcon('bank_account', $bankAccount, 'id');

echo '<ul class="commandList">';
if (! $bankAccountIsUsed) {
    echo '<li class="editLi">' . html::anchor('admin/bankAccount/edit?id=' . $bankAccount['id'], text::get('bankAccount.editThis')) . '</li>';
    echo '<li class="deleteLi">' . html::anchor('admin/bankAccount/delete?id=' . $bankAccount['id'], text::get('bankAccount.deleteThis'), array('onclick'=>'return confirmDeletion()')) . '</li>';
}
if ($bankAccount['enabled']) {
    echo '<li class="deleteLi">' . html::anchor('admin/bankAccount/disable?id=' . $bankAccount['id'], text::get('bankAccount.disableThis')) . '</li>';
}
else {
    echo '<li class="">' . html::anchor('admin/bankAccount/enable?id=' . $bankAccount['id'], text::get('bankAccount.enableThis')) . '</li>';
}
echo '</ul>';

if ($bankAccountIsUsed) {
    echo '<p class="warningNote">' . text::getEscaped('bankAccount-error-cannotBeEdited') . '</p>';
}
?>

<table class="displayTable">
    <tbody>
        <tr>
            <th><?php echo text::getEscaped('bankAccount.name'); ?></th>
            <td class="identifyingValue"><?php echo $bankAccount['name'] ?></td>
        </tr>
        <tr>
            <th><?php echo text::getEscaped('bankAccount.bank_name'); ?></th>
            <td><?php echo $bankAccount['bank_name'] ?></td>
        </tr>
        <tr>
            <th><?php echo text::getEscaped('bankAccount.number'); ?></th>
            <td><?php echo $bankAccount['number'] ?></td>
        </tr>
        <tr>
            <th><?php echo text::getEscaped('bankAccount.organization_id'); ?></th>
            <td><?php echo html::moreInfoPopup('/admin/organization/display?id=' . $bankAccount['organization_id'], $bankAccount['organization']['name']) ?></td>
        </tr>
        <tr>
            <th><?php echo text::getEscaped('bankAccount.iban'); ?></th>
            <td><?php echo $bankAccount['iban'] ?></td>
        </tr>
        <tr>
            <th><?php echo text::getEscaped('bankAccount.swift'); ?></th>
            <td><?php echo $bankAccount['swift'] ?></td>
        </tr>
        <tr>
            <th><?php echo text::getEscaped('bankAccount.enabled'); ?></th>
            <td><?php echo format::boolean($bankAccount['enabled']) ?></td>
        </tr>
    </tbody>
</table>

<?php
if ($seminarList) {
    echo '<h2>' . text::getEscaped('bankAccount.seminarsPaidToThisAccount') . '</h2>';

    $elb = new EntityListBuilder('seminar', $seminarList);
    $elb->setUuid($this->DISPLAY_SEMINAR_LIST_UUID);
    $elb->text('name')->openInPopup();
    $elb->date('begin_date');
    $elb->date('end_date');
    $elb->boolean('active');
    $elb->write();
}
    
if ($viSeminarList) {
    echo '<h2>' . text::getEscaped('bankAccount.viSeminarsPaidToThisAccount') . '</h2>';

    $elb = new EntityListBuilder('viSeminar', $viSeminarList);
    $elb->setUuid($this->DISPLAY_VISEMINAR_LIST_UUID);
    $elb->text('name')->openInPopup();
    $elb->date('begin_date');
    $elb->date('end_date');
    $elb->boolean('active');
    $elb->write();
}